package com.zjc.yohoshop.mvp.view.adapter;

import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zjc.yohoshop.R;
import com.zjc.yohoshop.bean.CarListEntity;
import com.zjc.yohoshop.network.API;

public class CarListHeadAdapter extends BaseQuickAdapter<CarListEntity.ValuesBean, BaseViewHolder> {
    public CarListHeadAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, CarListEntity.ValuesBean item) {
        ImageView imageView = helper.getView(R.id.iv_item_head_car_list_car_path);
        Glide.with(helper.itemView.getContext()).load(API.BaseUrl + item.car_path).into(imageView);
        helper.setText(R.id.tv_item_head_car_list_shop_name, item.shop_name);
        helper.setText(R.id.tv_item_head_car_list_shop_color, "颜色 : " + item.shop_color);
        helper.setText(R.id.tv_item_head_car_list_shop_size, "尺码 : " + item.shop_size);
        helper.setText(R.id.tv_item_head_car_list_shop_price, "￥" + item.shop_price);
        helper.setText(R.id.tv_item_head_car_list_shop_num, "X "  + item.shop_num);
        CheckBox checkBox = helper.getView(R.id.cb_item_head_car_list_shop_select);
        helper.addOnClickListener(R.id.cb_item_head_car_list_shop_select);
        if ("1".equals(item.shop_select)){
            checkBox.setChecked(true);
        }else{
            checkBox.setChecked(false);
        }

    }
}
